package cate.game.role.res.leader.hallows;

import cate.common.table.hallow.row.HallowSkillRow;
import cate.game.GameBody;
import cate.game.res.MixRes;
import cp.solution.pattern.ICopiable;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "圣器技能数据")
public class HallowSkill implements ICopiable<HallowSkill> {
    @NoteField(value = "类型")
    public int type;

    @NoteField(value = "等级")
    public int level;

    @NoteField(value = "技能ID")
    public int chooseSkill;

    public HallowSkill(int type, int level, int skillId) {
        this.type = type;
        this.level = level;
        this.chooseSkill = skillId;
    }

    public HallowSkill() {

    }

    @Override
    public HallowSkill copy() {
        HallowSkill cp = new HallowSkill();
        cp.type = this.type;
        cp.level = this.level;
        cp.chooseSkill = this.chooseSkill;
        return cp;
    }

    public MixRes back(GameBody game) {
        MixRes backReward = new MixRes();
        HallowSkillRow row = game.table.hallow.skill.getRowByTypeAndLevel(type, level);

        this.level = 1;

        if (row == null) {
            return backReward;
        }
        backReward.addList(new MixRes(row.backStr));

        return backReward;
    }
}
